package com.example.controller;

import com.example.common.Pager;
import com.example.common.Result;
import com.example.entity.VolunteerActivity;
import com.example.entity.VolunteerJoinActivity;
import com.example.entity.VolunteerMessage;
import com.example.service.VolunteerActivityService;
import com.example.service.VolunteerMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author 紫煦桉
 */
@RequestMapping("/volunteerJoinActivity")
@Controller
public class VolunteerJoinActivityController extends SuperController<VolunteerJoinActivity> {

    private VolunteerMessageService volunteerMessageService;
    private VolunteerActivityService volunteerActivityService;
    @Autowired
    private void setService(VolunteerMessageService volunteerMessageService, VolunteerActivityService volunteerActivityService) {
        this.volunteerMessageService = volunteerMessageService;
        this.volunteerActivityService = volunteerActivityService;
    }

    @RequestMapping("/volunteerMessageList")
    @ResponseBody
    public List<VolunteerMessage> allVolunteerMessage() {
        return volunteerMessageService.findAll();
    }

    @RequestMapping("/volunteerActivityList")
    @ResponseBody
    public List<VolunteerActivity> allVolunteerActivity() {
        return volunteerActivityService.findAll();
    }

    @Override
    @RequestMapping("/list")
    @ResponseBody
    public Pager<VolunteerJoinActivity> list(VolunteerJoinActivity param, @RequestParam(defaultValue = "1", value = "page") String page,
                                             @RequestParam(defaultValue = "10", value = "rows") String size) {
        return super.list(param, page, size);
    }

    @Override
    @RequestMapping("/add")
    @ResponseBody
    public Result add(VolunteerJoinActivity param) {
        return super.add(param);
    }

    @Override
    @RequestMapping("/edit")
    @ResponseBody
    public Result edit(VolunteerJoinActivity param) {
        return super.edit(param);
    }

    @Override
    @RequestMapping("/delete")
    @ResponseBody
    public Result delete(VolunteerJoinActivity param) {
        return super.delete(param);
    }
}
